using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class DispAddressMap : EntityTypeConfiguration<DispAddress>
	{
		public DispAddressMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.City)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.Address)
				.IsRequired()
				.HasMaxLength(100);
				
			this.Property(t => t.HashAddress)
				.IsRequired()
				.HasMaxLength(100);
				
			this.Property(t => t.ExpressCompany)
				.HasMaxLength(100);
				
			// Table & Column Mappings
			this.ToTable("DispAddress");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.City).HasColumnName("City");
			this.Property(t => t.Address).HasColumnName("Address");
			this.Property(t => t.HashAddress).HasColumnName("HashAddress");
			this.Property(t => t.StationId).HasColumnName("StationId");
			this.Property(t => t.ConfirmCount).HasColumnName("ConfirmCount");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.IsEnabled).HasColumnName("IsEnabled");
			this.Property(t => t.ExpressCompany).HasColumnName("ExpressCompany");
			this.Property(t => t.Sources).HasColumnName("Sources");
		}
	}
}

